package com.cqc.jdk8.Jtime;

import org.junit.Test;

import java.time.LocalDate;
import java.time.MonthDay;

/**
 * @author cui
 * @date 2024/6/29 20:51
 * @description
 **/
public class MonthDayTest {


    /**
     * 判断当天是不是生日MonthDay
     */
    @Test
    public void f1() {
        LocalDate localDate = LocalDate.of(1989, 9, 2);
        MonthDay birthday = MonthDay.of(localDate.getMonthValue(), localDate.getDayOfMonth());
        MonthDay currentMonthDay = MonthDay.from(LocalDate.now());

        if (currentMonthDay.equals(birthday)) {
            System.out.println("是你的生日");
        } else {
            System.out.println("你的生日还没有到");
        }
    }
}
